package ru.myrtle.umf.query.condition;

public abstract class UStringAdapter implements UValueAdapter<String> {

    /**
     * The simplest <code>StringAdapter</code> implementation that represents
     * the case when the argument object to adapt is a
     * <code>String<code> object itself.
     */
    public static final UStringAdapter DEFAULT = new UStringAdapter() {

        @Override
        public String getString(Object object) {
            return (String) object;
        }
    };

    /**
     * Extracts from/Adapts the argument object to a <code>String<code>
     *
     * @param object The argument object to adapt to a <code>String<code> by this adapter
     * @return String the <code>String<code> object representation of the argument object
     */
    public abstract String getString(Object object);

    public String adapt(Object value) {
        return getString(value);
    }
}
